package domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;

@Entity
public class ContactGroup {
	private String groupName;
	private long groupId;
	private Set<Contact> contacts = new HashSet<Contact>();
//	private int version;

	public ContactGroup(){}

	public ContactGroup(String groupName, Set<Contact> contacts) {
		this.groupName = groupName;
		this.contacts = contacts;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getGroupId() {
		return groupId;
	}

	public void setGroupId(long groupId) {
		this.groupId = groupId;
	}
	
	@ManyToMany(mappedBy="books")
	public Set<Contact> getContacts() {
		return contacts;
	}

	public void setContacts(Set<Contact> contacts) {
		this.contacts = contacts;
	}

}
